home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
050a.dms
/
050a.adf
/
TEXTS
/
hints_and_tips.txt
< prev
next >
Wrap
Text File
|
1992-02-26
|
9KB
|
178 lines
HINTS AND TIPS
--------------
Following are a few hints and tips donated by readers of F1 Licenceware's
Amos programmers disk mag, Amoszine. See Amos contacts for more details.
-------------------------------------------------------------------------
To find out how your program would run under the American NTSC
system just enter this at the start of your listing:
Doke $DFF1DC,0
To return back to the PAL system use this:
Doke $DFF1DC,32
You could use these dokes as a switch inside your program making it
almost world-wide compatible.
Don't use multiple if's
For example.
If A=1 Then Proc A1
If A=2 Then Proc A2
If A=3 Then Proc A3
If A=4 Then Proc A4
Can be replaced with.
On A Proc A1,A2,A3,A4
Although this method cannot pass variables, it is much faster than using
multiple IF's with more conditions resulting in more of a gain in speed.
Save some memory
----------------
SET SPRITE BUFFER 16 (If not using any sprites/bobs. saves about 10k)
CLOSE WORKBENCH (saves around 40k)
CLOSE EDITOR (saves about 26k)
Is disk in DF0: write protected or not?
---------------------------------------
POKE $BFD100,%10000 `Change to %1000 FOR DF1:
A=BTST (3,$BFE001)
IF A=-1 THEN PRINT "DISK WRITE ENABLED"
IF A= 0 THEN PRINT "DISK WRITE PROTECTED"
Change mouse pointer colours
----------------------------
COLOUR 17,$FFF
COLOUR 18,$123
COLOUR 19,$0
Obviously change the $rgb values to what you want.
Print a line of anything
------------------------
PRINT STRING$ ("^",80) ` will print 80 ^ on screen
PRINT SPACE$ (80) `Will print 80 spaces
Note:
You can put anything inside the " " of the first line and change the
80 to any number you wish the equivalent line to be:
PRINT"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^etc"
Clear just a portion of the screen
-----------------------------------
CLS 12,14,39 to 305,70
The 12 is a colour
the 14,39 is the top right coordinates of the portion to clear
and the 305,70 is the bottom left coordinates
This can be a very useful command but is overlooked by a lot of people
Display palette
---------------
Here is a neat little four liner that will display the colours of the
current palette in use, like in an art package.
FOR L=0 TO 15: INK L `set to loop 16 times 0-15
BAR (L+1)*16,170 TO (L+2)*16,177 `Draw a filled box in INK colour(L
NEXT L `If L is less than 15 repeat loop
STOP `Loop finished
This will draw 16 filled boxes using the BAR instruction.
each box will be filled with the current INK colour which is changed by
the FOR NEXT loop using INK L, L starts off with the value 0 and
every time the program hits the NEXT L line it checks L is less than 15
and if so adds 1 to L, when L eventually is equal to 15 the loop is
completed and the STOP instruction is executed ending the program.
Screen wipe
-----------------
This is the screen wipe used on the loading screen of Amoszine 1.
INK 0
FOR X=0 TO 319
DRAW 0,199 TO X,0
NEXT X
FOR Y=1 TO 199
DRAW 0,199 TO 319,Y
NEXT Y
Centre Text V2
--------------
This is a handy routine that will centre any text inside T$ on to the
screen This works for both horizontally and vertically, unlike the
CENTRE command.
T$="MONGOLIAN INTRUDERS FROM PLANET RED" ` Put some text in T$
A=LEN(T$) ` How long is it?
TEXT SCREEN WIDTH/2 - (A*8/2), SCREEN HEIGHT/2,T$` See below
First we put the message we want printed into T$ and then A is told to
hold the length of T$.
TEXT is very similar to print except it can place the TEXT cursor
anywhere on screen to a pixel, where as LOCATE and PRINT can only be
defined by 8 pixels (or one character square if you like.)
SCREEN WIDTH returns the WIDTH of the SCREEN and SCREEN HEIGHT does
what you would expect. The calculation performed gives the exact
central x,y position on the screen to place the text in T$, for example
SCREEN HEIGHT/2 will be exactly half way down the screen,
SCREEN WIDTH/2 half way across.
This is the routine Lee Bamber wrote for the clock we use in Amoszine.
----------------------------------------------------------------------
REM Clock, By Lee Bamber for Amoszine
REM Set up vars for hours minutes and seconds
Time=Timer:Times=0:Timem=0:Timeh=0
Rem your main loop
Do
Gosub CONSTRUCT_TIME
Loop
REM The subroutine
CONSTRUCT_TIME:
Time$=((Timer-time)/50)
If Times>=60
Times=0:Time=Timer
Inc Timem
If Timem>=60
Timem=0
Inc timeh
Endif
Endif
REM The following two lines should be all on one,
I couldn't fit it on here.
Time$=Mid$(Str$(100+Timeh),3,2)+":"+Mid$(Str$(100+Timem),3,2)+":"+Mid$
(Str$(100+Times),3,2
Pen 1:Paper 0:Home:Print Time$
Return
END OF HINTS AND TIPS
^^^^^^^^^^^^^^^^^^^^^